<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 类的首字母大写
        class Star {
            // 类的共有属性放到constructor里面
            constructor(uname, song) {
                this.name = uname,
                    this.song = song
            }
            // 公有方法
            dance(name) {
                console.log(name);
            }
            // 静态方法,cxk不能直接调用，只能用Star调用
            static rap() { console.log('我会rap'); }

        }

        const cxk = new Star('ikun', '只因你太美')
        cxk.dance('背带裤')
        Star.rap()
        console.log(cxk);
    </script>
</body>

</html>